package com.yootk.listener;


import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.Lifecycle;
import org.springframework.context.SmartLifecycle;
import org.springframework.stereotype.Component;
@Component
public class MessageListener implements SmartLifecycle {
    private static final Logger LOGGER = LoggerFactory.getLogger(MessageListener.class) ;
    private boolean running = false ;
    public void onListener(String msg){
        LOGGER.info("【1】接收消息：{}",msg);
    }

    @Override
    public void start() {
        LOGGER.info("【1】打开通道");
        this.running = true ;
    }

    @Override
    public void stop() {
        this.running = false ;
        LOGGER.info("【1】关闭通道");
    }

    @Override
    public boolean isRunning() {
        return this.running;
    }

    @Override
    public boolean isAutoStartup() {
        return true;
    }

    @Override
    public int getPhase() {
        return 1;
    }
}
